Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set DefaultPowerReduction in app.go, added flags to script, changed swap calculation, made backup folder unique and added useful swap scripts. #8

Merged

Conversation

zenodeapp
Copy link

@zenodeapp zenodeapp commented Sep 4, 2023

Important changes

  • Default power reduction changed to 10^18, instead of 10^6
  • Added flags --crisis-skip, --skip-state-download, --reset-priv-val-state, --no-service and --no-start to script
  • Script now always backs up data/priv_validator_state.json, unless --reset-priv-val-state flag is used
  • Backup folder names are auto-generated based on current time (Make sure to read the warning below)
  • Swap space is now calculated based on how much is actually free, rather than checking total mem
  • Useful swap scripts added as a bonus

Changed DefaultPowerReduction

The DefaultPowerReduction in our cronos fork was never changed in the app.go file. This caused the chain to get a consensus failure error upon committing a new block. As we use tokens with 18 decimals, instead of 6, very large numbers were used to calculate the total voting power in cosmos-sdk, resulting in a valset that was too large and triggered an overflow error in CometBFT (Tendermint fork).

Script flags/options

Running sh genesisd.sh gives:

Usage: genesisd.sh <command> [moniker]
   <command> should be either 'upgrade' or 'init'

   Options:
     --crisis-skip            Makes sure that genesisd starts with the --x-crisis-skip-assert-invariants flag (default: false)
     --skip-state-download    Skips downloading the genesis.json file, only do this if you're certain to have the correct state file already (default: false)
     --reset-priv-val-state   Resets data/priv_validator_state.json file [UNSAFE] (default: false)
     --no-service             This prevents the genesisd service from being made (default: false)
     --no-start               This prevents the genesisd service from starting at the end of the script (default: false)

Especially flags like --skip-state-download and --reset-priv-val-state will be of use for us in the upcoming upgrade. I believe that those who haven't upgraded at all should use the flag --reset-priv-val-state, but those who already tried upgrading and have their nodes running should not use that flag to prevent a potential double-sign to occur (which could lead to them getting slashed, which is steep for double-signing. Think it was 5% for double-signing).

Backup folder name

The backup folder was named .genesisd_backup, but running the script multiple times or stopping it mid-process could lead to nasty overwrites and loss of important data. Therefore every time the script is run a unique name is generated based on the system's current time (ex: .genesisd_backup_20230913213142).

WARNING: running the script multiple times will continue to create new backup folders. Since our state file is large this would mean that it will be around ~14GB every time a backup is made. Make sure to remove older backup folders if you plan on running the script more often (testing purposes for instance). They're hidden folders in the root folder; use cd ~ then ls -a to see them.

Swap calculation

Some are not able to get the service running because of the amount of swap it's creating on a system that is under load. It's better to check MemAvailable and SwapFree instead of MemTotal and SwapTotal. While it is not that accurate (as this highly depends on the moment the script is run), it is still better than checking the total.

Therefore I had to move the halting of the genesisd and genesis services before the swap calculation, else the SwapFree and MemAvailable calculation would be off if the service was running already.

Useful swap scripts (Bonus)

I've added some swap scripts to quickly add or remove swap (genesisd swapfiles, not other ones).
First cd genesisL1/genesisd_scripts into the folder.

  • Adding swap
    sh swap_add.sh <amount_of_swap_in_gb> (ex: sh swap_add.sh 50 creates a new genesisd_swapfile that is 50GB big)

  • Removing swap
    sh swap_remove.sh <filename> (ex: sh swap_remove.sh /genesisd_swapfile_2)

  • Removing all swaps
    sh swap_remove_all.sh (removes only genesisd_swapfiles)

@zenodeapp zenodeapp changed the title Added --x-crisis-skip-assert-invariants and changed swap calculation to check available mem and swap instead of checking the total Added --x-crisis-skip-assert-invariants, changed swap calculation and added useful swap scripts Sep 4, 2023
@zenodeapp zenodeapp changed the title Added --x-crisis-skip-assert-invariants, changed swap calculation and added useful swap scripts Set DefaultPowerReduction in app.go, added flags to script, changed swap calculation, added swap scripts and made backup folder unique. Sep 13, 2023
@zenodeapp zenodeapp changed the title Set DefaultPowerReduction in app.go, added flags to script, changed swap calculation, added swap scripts and made backup folder unique. Set DefaultPowerReduction in app.go, added flags to script, changed swap calculation, made backup folder unique and added useful swap scripts. Sep 13, 2023
@alpha-omega-labs alpha-omega-labs merged commit 9d84eb0 into alpha-omega-labs:release.46.15 Sep 14, 2023
alpha-omega-labs pushed a commit that referenced this pull request Feb 1, 2024
Attempt to upgrade v1.0.12 to v1.0.15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants